package com.ysd.util;

import com.google.gson.Gson;

/** * 处理结果 * @author Administrator * */
public class Result {
	public boolean success;// 是否成功
	public String message;// 信息
	public String remark;// 备注

	public static String toClient(boolean suc, Object msg) {
		Result r = new Result();
		r.success = suc;
		r.message = msg.toString();
		r.remark = "";
		Gson t = new Gson();
		return t.toJson(r);
	}
	
	// 加了static的方法可以直接通过"类名.方法名"类进行调用,Result.toClient(true, "成功" , "备注")
	public static String toClient(boolean suc, Object msg, String remark) {
		Result r = new Result();
		r.success = suc;
		r.message = msg.toString();
		r.remark = remark;
		Gson t = new Gson();
		return t.toJson(r);// 转化为json格式字符串 
	}
}
